#include <stdio.h>

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        perror("./mycat filename!\n");
        return 1;
    }
    FILE *fil = fopen(argv[1], "r");
    if (fil == NULL)
    {
        perror("fopen fail!\n");
        return 2;
    }
    while (1)
    {
        char arr[1024]={};
        size_t n = fread(arr, 1, sizeof(arr) - 1, fil);
        if (n < 0)
        {
            perror("fread fail!\n");
            return 3;
        }
        printf("%s\n", arr);
        if(feof(fil))
        {
            break;
        }
    }
    fclose(fil);
    return 0;
}